#ifndef __UM_LOG_H
#define __UM_LOG_H

#include "um_conf.h"
#include "segger_rtt.h"


//#define PRINTF(...)     do{  TraceSend(__VA_ARGS__); }while(0)
#ifdef USE_DEBUG
#define PRINTF(...)     SEGGER_RTT_printf(0, __VA_ARGS__)
#else
#define PRINTF(...)
#endif


#define UM_LOG_ENABLED

#define UM_LOG_MSG_MAXLEN       (255)
#define UM_LOG_MOD_NAME_LEN     (7)
#define UM_LOG_PREFIX_FMT       "[%s] %s(%d): "
#define UM_LOG_HEXDUMP_SEP_LINE "+" \
    "-----------------------" \
    "-----------------------" \
    "-----------------------"

#if defined(_PLATFORM_IS_LINUX_)
#undef  UM_LOG_MSG_MAXLEN
#define UM_LOG_MSG_MAXLEN                  (512)
#endif


typedef struct {
    char            name[UM_LOG_MOD_NAME_LEN + 1];
    int             priority;
    char            text_buf[UM_LOG_MSG_MAXLEN + 1];
} log_client;


#endif
